package service.impl;

import mapper.Dev_userMapper;
import org.springframework.stereotype.Service;
import pojo.App_info;
import pojo.Dev_user;
import pojo.Page;
import service.Dev_userService;

import javax.annotation.Resource;
import java.util.List;

@Service("dev_userService")
public class Dev_userServiceImpl implements Dev_userService {
    @Resource
    private Dev_userMapper devUserMapper;
    @Override
    public Dev_user getUser(String devCode, String devPassword) {
        return devUserMapper.getUser(devCode,devPassword);
    }

    @Override
    public int devCode(String devCode) {
        return devUserMapper.devCode(devCode);
    }

    @Override
    public int devPassword(String devPassword) {
        return devUserMapper.devPassword(devPassword);
    }

    @Override
    public List<App_info> list(Page page, String softwareName, Integer status, Integer flatformId, Integer categoryLevel1, Integer categoryLevel2, Integer categoryLevel3) {
        return devUserMapper.list(page,softwareName,status,flatformId,categoryLevel1,categoryLevel2,categoryLevel3);
    }

    @Override
    public void fy(Page page, String softwareName, Integer status, Integer flatformId, Integer categoryLevel1, Integer categoryLevel2, Integer categoryLevel3) {
        int count=devUserMapper.getCount(softwareName,status,flatformId,categoryLevel1,categoryLevel2,categoryLevel3);
        page.setTotalCount(count);
        if (page.getCurrentPageNo()>page.getTotalPageCount()){
            page.setCurrentPageNo(page.getTotalPageCount());
        }
        if (page.getCurrentPageNo()<1){
            page.setCurrentPageNo(1);
        }
        page.setShu((page.getCurrentPageNo()-1)*page.getPageSize());
        List<App_info> list=devUserMapper.list(page,softwareName,status,flatformId,categoryLevel1,categoryLevel2,categoryLevel3);
        page.setList(list);
    }
}
